
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
rename-keys
Advanced tools
Modify the names of the own enumerable properties (keys) of an object.
Bug? Feature request? Please create an issue.
npm i rename-keys --save
bower install rename-keys --save
var rename = require('rename-keys');
rename( object, function );
Arguments
object {Object}
: the object to iterate over.function {Function}
: the function to use to rename each own enumerable property of object
.The object to iterate over:
var pkg = require('./package.json');
and this renaming function:
var addDashes = function(str) {
return '--' + str;
};
console.log(rename(pkg, addDashes));
results in:
{ "--name": "rename-keys",
"--description": "Modify the names of the own enumerable properties (keys) of an object.",
"--version": "0.1.0",
"--homepage": "https://github.com/jonschlinkert/rename-keys",
"--author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
} ... }
Rename based on value
The value can also be passed in as as a second argument.
rename({a: 1, b: 2, c: 3}, function(key, value) {
if (value > 1) return key + 'x';
});
results in:
{a: 1, bx: 2, cx: 3});
Jon Schlinkert
Copyright (c) 2014-2015, Jon Schlinkert. Released under the MIT license
[1.2.0] - 2017-10-13
FAQs
Modify the names of the own enumerable properties (keys) of an object.
The npm package rename-keys receives a total of 73,950 weekly downloads. As such, rename-keys popularity was classified as popular.
We found that rename-keys demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.